/**
 * 筛选出有效的sql语句
 * @param args 
 */
 export const getUserInfoVailidateSql = (body: Record<string, string>): [boolean, string, string[]] => {
    let { username, intro, motto, occup, avatar } = body

    // sql语句
    let sql = `UPDATE user SET `,
        empty = true,
        res = [];

    // 只要不为空, 就拼接起来

    if (username != undefined) {
        res.push(username)
        sql += `username=?, `
        empty = false
    }

    if (intro != undefined) {
        res.push(intro)
        sql += `intro=?, `
        empty = false
    }

    if (motto != undefined) {
        res.push(motto)
        sql += `motto=?, `
        empty = false
    }

    if (occup != undefined) {
        res.push(occup)
        sql += `occup=?, `
        empty = false
    }

    if (avatar != undefined) {
        res.push(avatar)
        sql += `avatar=?, `
        empty = false
    }

    // 不为空, 截掉最后一个逗号
    if (!empty) {
        sql = sql.slice(0, -2)
    }

    return [empty, sql, res];
}   